<template>
	<div class="clearfloat padding-across-10" style="height:100%;margin-bottom: 100px" v-loading="loading" element-loading-text="拼命加载中">
		<div class="navList">
			<div>
				<el-button size="small" type="primary" @click="reloadDatas">
					<i class="el-icon el-icon-eleg-icon_refresh el-icon--left"></i>刷新
				</el-button>
				<el-button size="small" type="danger" @click="openFailure">
					<i class="el-icon-eleg-icon_error-triangle el-icon--left"></i>故障记录
				</el-button>
				<el-button size="small" type="danger" @click="openExp">
					<i class="el-icon-eleg-icon_clipboard el-icon--left"></i>异常报告
				</el-button>
			</div>
		</div>
		<el-row :gutter="10">
			<el-col :span="24">
				<!-- 设备信息 -->
				<div class="bg-purple">
					<div class="panel-title">
						<span style="width: 30%">设备码：{{this.templateObj.sn}}</span>
						<span style="width: 40%;font-size: 13px;">(最后一次与服务器连接时间：{{pingTime}})</span>
						<img class="title-img" v-bind:src="imgUrl">
					</div>
					<el-row style="box-shadow: 2px 2px 5px #888888;border: 1px solid #B0B0B0;">
						<el-col :span="24">
							<el-table border style="width: 100%;margin-top: 1px" :data="deviceData" v-if="this.templateObj.model === 'TC1000'">
								<el-table-column label="名称" align="center">
									<template slot-scope="scope">
										<span>{{scope.row.name}}</span><el-button type="text" @click="changeName(scope.row)"><i class="el-icon-edit"></i></el-button>
									</template>
								</el-table-column>
								<el-table-column label="安卓版本号" align="center" prop="androidver"></el-table-column>
								<el-table-column label="印斯特App版本" align="center" prop="insyteappver"></el-table-column>
								<el-table-column label="IO板卡固件信息" align="center" prop="iover"></el-table-column>
								<el-table-column label="多媒体板卡固件信息" align="center" prop="multimediaver">
								</el-table-column>
								<el-table-column label="无线版本" align="center" prop="zbver"></el-table-column>
							</el-table>
							<el-table border style="width: 100%;margin-top: 1px" :data="deviceData" v-if="this.templateObj.model === 'TC2000'">
								<el-table-column label="名称" align="center" prop="name">
								</el-table-column>
								<el-table-column label="安卓版本号" align="center" prop="androidver"></el-table-column>
								<el-table-column label="印斯特App版本" align="center" prop="insyteappver"></el-table-column>
								<el-table-column label="串口HUB模块版本" align="center" prop="serialver">
								</el-table-column>
								<el-table-column label="基础模块版本" align="center" prop="basever"></el-table-column>
								<el-table-column label="按键模块版本" align="center" prop="keyver"></el-table-column>
								<el-table-column label="功率模块版本" align="center" prop="powerver"></el-table-column>
								<el-table-column label="无线版本" align="center" prop="zbver"></el-table-column>
							</el-table>
						</el-col>
					</el-row>
				</div>
			</el-col>
			<el-col :span="isMobile ? 24 : 12">
				<el-row :gutter="5">
					<!-- 智慧教室 -->
					<el-col :span="isMobile ? 24 : 24" style="padding-top: 5px">
						<div class="bg-purple">
							<div class="panel-title">
								<span style="width: 70%">智慧教室</span>
								<img class="title-img" v-bind:src="imgUrl">
							</div>
							<el-row :gutter="5">
								<el-col :span="isMobile ? 24 : 8" style="margin-top: 3px;">
									<div class="grid-content1 bg-purple">
										<div class="detail-section" v-loading="classSetObj.waitting">
											<div class="section-left">
												<div class="detail-title">
													<span style="font-weight: bold">上下课</span>
													<i class="fa fa-bell" style="color: #EE7942;padding-top: 10px"></i>
												</div>
											</div>
											<div class="section-right">
												<div>
													<el-button :disabled="!IsOnLine" type="primary" size="small" @click="startClass">
														上 课
													</el-button>
												</div>
												<div>
													<el-button :disabled="!IsOnLine" type="danger" size="small" @click="closeClass">
														下 课
													</el-button>
												</div>
											</div>
										</div>
									</div>
								</el-col>
								<el-col :span="isMobile ? 24 : 8" style="margin-top: 3px;">
									<div class="grid-content1 bg-purple">
										<div class="detail-section" v-loading="lockScreenObj.waitting">
											<div class="section-left">
												<div class="detail-title">
													<span style="font-weight: bold">远程控制</span>
													<i class="fa fa-gears" style="color: #EE7942;padding-top: 10px"></i>
												</div>
											</div>
											<div class="section-right">
												<div>
													<el-button :disabled="!IsOnLine" type="primary" size="small" @click="unLockScreen">解 锁
													</el-button>
												</div>
												<div>
													<el-button :disabled="!IsOnLine" type="danger" size="small" @click="lockScreen">锁 屏
													</el-button>
												</div>
											</div>
										</div>
									</div>
								</el-col>
								<el-col :span="isMobile ? 24 : 8" style="margin-top: 3px;" v-if="statusDatas.microphone != -1">
									<div class="grid-content1 bg-purple">
										<div class="detail-section" v-loading="controlMicroPhoneObj.waitting
										">
										<div class="section-left">
											<div class="detail-title">
												<span style="font-weight: bold;">麦克风</span>
												<i v-if="statusDatas.microphone" class="fa fa-microphone" style="color: #13ce66;padding-top: 10px"></i>
												<i v-else class="fa fa-microphone" style="padding-top: 10px;color: #999999"></i>
											</div>
										</div>
										<div class="section-right">
											<div>
												<small>状态：
													<el-tag v-if="statusDatas.microphone" type="success">开启</el-tag>
													<el-tag v-else type="danger">关闭</el-tag>
												</small>
											</div>
											<div class="switch">
												<el-switch :disabled="!IsOnLine" v-model="statusDatas.microphone" off-color="#ff6d6d" on-color="#13ce66" :on-text="$t('message.on')" :off-text="$t('message.off')" @change="controlMicroPhone">
												</el-switch>
											</div>
										</div>
									</div>
								</div>
							</el-col>
							<el-col :span="isMobile ? 24 : 8" style="margin-top: 3px;" v-if="statusDatas.volume != -1">
								<div class="grid-content1 bg-purple" v-loading="controlVolumeObj.waitting">
									<div class="detail-section">
										<div class="section-left">
											<div class="detail-title">
												<span style="font-weight: bold;">音量控制</span>
												<i v-if="statusDatas.quiet" class="el-icon-eleg-icon_vol-mute" style="color:#13ce66;font-size: 40px;padding-top: 10px"></i>
												<i v-if="!statusDatas.quiet && statusDatas.volume >= 80" class="el-icon-eleg-icon_volume-high" style="color:#13ce66;font-size: 40px;padding-top: 10px"></i>
												<i v-if="!statusDatas.quiet && statusDatas.volume < 80" class="el-icon-eleg-icon_volume-low" style="color:#13ce66;font-size: 40px;padding-top: 10px"></i>
											</div>
										</div>
										<div class="section-right" style="text-align: left;padding-left: 10px">
											<div>
												<el-switch :disabled="!IsOnLine" v-model="statusDatas.quiet" on-color="#ff6d6d" off-color="#13ce66" on-text="静音" off-text="正常" @change="controlQuiet">
												</el-switch>
											</div>
											<div style="padding-right: 2px">
												<el-slider :disabled="!IsOnLine" @change="changeVolume" :max="100" :min="0" v-model="statusDatas.volume"></el-slider>
											</div>
										</div>
									</div>
								</div>
							</el-col>
							<el-col :span="isMobile ? 24 : 8" style="margin-top: 3px;" v-if="this.templateObj.model == 'TC2000'">
								<div class="grid-content1 bg-purple" v-loading="previewObj.waitting">
									<div class="detail-section">
										<div class="section-left">
											<div class="detail-title">
												<span style="font-weight: bold;">预监功能</span>
												<i v-if="statusDatas.preview" class="fa fa-eye" style="color: #13ce66;padding-top: 10px"></i>
												<i v-else class="fa fa-eye" style="padding-top: 10px;color: #999999"></i>
											</div>
										</div>
										<div class="section-right" style="text-align: center;padding-left: 10px">
											<div>
												<small>状态：
													<el-tag v-if="statusDatas.preview" type="success">开启</el-tag>
													<el-tag v-else type="danger">关闭</el-tag>
												</small>
											</div>
											<div>
												<el-switch :disabled="!IsOnLine" v-model="statusDatas.preview" off-color="#ff6d6d" on-color="#13ce66" :on-text="$t('message.on')" :off-text="$t('message.off')"  @change="controlPreview">
												</el-switch>
											</div>
										</div>
									</div>
								</div>
							</el-col>
							<el-col :span="isMobile ? 24 : 8" style="margin-top: 3px;">
								<div class="grid-content1 bg-purple" style="background-color: #1a9624">
									<div class="detail-section">
										<div class="section-left">
											<div class="detail-title">
												<i class="fa fa-envelope" style="color:#93ff9c;font-size: 60px"></i>
											</div>
										</div>
										<div class="section-right" style="text-align: left;padding-left: 20px">
											<div><span style="font-weight: bold;color: white">消息服务</span></div>
											<div>
												<span style="font-weight: bold;color: white">状态：{{statusDatas.mqttserver ? '断开' : '连接'}}</span>
											</div>
										</div>
									</div>
								</div>
							</el-col>
						</el-row>
					</div>
				</el-col>
				<!-- 电脑 -->
				<el-col :span="24" style="padding-top: 5px" v-if="cptDatas&&cptDatas.length>0">
					<div class="bg-purple">
						<div class="panel-title">
							<span style="width: 70%">电脑</span>
							<img class="title-img" v-bind:src="imgUrl">
						</div>
						<el-row :gutter="5">
							<el-col :span="24" style="display: flex;" v-for="item in cptDatas">
								<div style="margin-top: 3px;" class="grid-content1 bg-purple" v-loading="item.waitting">
									<div class="detail-section2" style="height: auto;padding-bottom: 10px;">
										<div class="section-top2">
											<div>
												<span style="font-weight: bold;">{{item.name}}({{item.status ? '在线' : '离线'}})</span>
												<el-switch :disabled="!IsOnLine || !item.status" v-model="item.state" on-color="#13ce66" :on-text="$t('message.on')" :off-text="$t('message.off')" @change="controlCpt(item)">
												</el-switch>
											</div>
										</div>
										<div class="section-bottom2" style="display: flex;text-align: left">
											<div class="section-bottom3" style="flex-direction: column;text-align:left;padding-left: 5px">
												<div>
													<small>运行时长(H)：{{item.ctime}}</small>
												</div>
												<div>
													<small>操作系统：{{item.info.OSVersion?item.info.OSVersion:"未知"}}</small>
												</div>
												<div>
													<small>系统：{{item.info.OSBit}}位</small>
												</div>
													<!--<div>
													<small>服务版本：{{item.info.OSServiceVersion?item.info.OSServiceVersion:"未知"}}</small>
												</div>-->
											</div>
											<div class="section-bottom3" style="flex-direction: column;;text-align:left;padding-left: 5px">
												<div>
													<small>总物理内存：{{item.info.TotalPhysicalMemory}}</small>
												</div>
												<div>
													<small>空闲物理内存：{{item.info.FreePhysicalMemory}}</small>
												</div>
												<div>
													<small>内存使用率：{{item.info.MemoryInUse}}</small>
												</div>
											</div>
											<div class="section-bottom3" style="flex-direction: column;;text-align:left;padding-left: 5px">
												<div>
													<small>总虚拟内存：{{item.info.TotalVirtualMemory}}</small>
												</div>
												<div>
													<small>空闲虚拟内存：{{item.info.FreeVirtualMemory}}</small>
												</div>
													<!--<div>
													<small>处理器：{{item.info.ProcessorName?item.info.ProcessorName:"未知"}}</small>
												</div>-->
												<div>
													<small>处理器核心使用数：{{item.info.CpuUsed}}</small>
												</div>
											</div>
										</div>
									</div>
								</div>
							</el-col>
						</el-row>
					</div>
				</el-col>
				<!-- 一体机 -->
				<el-col :span="24" style="padding-top: 5px" v-if="aioDatas&&aioDatas.length>0">
					<div class="bg-purple">
						<div class="panel-title">
							<span style="width: 70%">一体机</span>
							<img class="title-img" v-bind:src="imgUrl">
						</div>
						<el-row :gutter="5">
							<el-col :span="isMobile ? 24 : 12" style="display: flex" v-for="item in aioDatas">
								<div style="margin-top: 5px;" class="grid-content1 bg-purple" v-loading="item.waitting">
									<div class="detail-section2">
										<div class="section-top2">
											<div style="padding: 0 3px">
												<span style="font-weight: bold;padding-right: 10px">{{item.name}}({{item.online ? '在线' : '离线'}})</span>
											</div>
										</div>
										<el-row :gutter="5" style="width: auto;">
											<el-col :span="isMobile ? 24 : 6">
												<div class="section-right" style="text-align: center">
													<div>
														<small style="font-size: 15px;font-weight: bold">一体机</small>
													</div>
													<div style="padding-top: 10px">
														<el-switch :disabled="!IsOnLine || !item.online" v-model="item.aiostatus" on-color="#13ce66" on-text="开启" off-text="关闭" @change="controlAio(item,1)">
														</el-switch>
													</div>
												</div>
											</el-col>
											<el-col :span="isMobile ? 24 : 6">
												<div class="section-right" style="text-align: center">
													<div>
														<small style="font-size: 15px;font-weight: bold">内部电脑</small>
													</div>
													<div style="padding-top: 10px">
														<el-switch :disabled="!IsOnLine || !item.online" v-model="item.pcstatus" on-color="#13ce66" on-text="开启" off-text="关闭" @change="controlAio(item,2)">
														</el-switch>
													</div>
												</div>
											</el-col>
											<el-col :span="isMobile ? 24 : 6">
												<div class="section-right" style="text-align: center">
													<div>
														<small style="font-size: 15px;font-weight: bold">无线话筒</small>
													</div>
													<div style="padding-top: 10px">
														<el-switch :disabled="!IsOnLine || !item.online" v-model="item.microstatus" on-color="#13ce66" on-text="开启" off-text="关闭" @change="controlAio(item,3)">
														</el-switch>
													</div>
												</div>
											</el-col>
											<el-col :span="isMobile ? 24 : 6">
												<div class="section-right" style="text-align: center">
													<div>
														<small style="font-size: 15px;font-weight: bold">蓝牙</small>
													</div>
													<div style="padding-top: 10px">
														<el-switch :disabled="!IsOnLine || !item.online" v-model="item.bluetoothstatus" on-color="#13ce66" on-text="开启" off-text="关闭" @change="controlAio(item,4)">
														</el-switch>
													</div>
												</div>
											</el-col>
										</el-row>
									</div>
								</div>
							</el-col>
						</el-row>
					</div>
				</el-col>
				<!-- 空调 -->
				<el-col :span="24" style="padding-top: 5px" v-if="airDatas&&airDatas.length>0">
					<div class="bg-purple">
						<div class="panel-title">
							<span style="width: 70%">空调</span>
							<img class="title-img" v-bind:src="imgUrl">
						</div>
						<el-row :gutter="5">
							<el-col :span="24" v-for="item in airDatas" style="margin-top: 3px;">
								<div class="grid-content1 bg-purple" v-loading="item.waitting">
									<div class="detail-section">
										<div class="section-left" style="width: 20%">
											<div class="detail-title">
												<img v-if="item.state" src="../../../../assets/images/kton.png">
												<img v-else src="../../../../assets/images/ktoff.png">
											</div>
											<div>
												<span style="font-weight: bold">{{item.name}}({{item.online ? '在线' : '离线'}})</span>
											</div>
										</div>
										<div class="section-right" style="text-align: center;width: 30%">
											<div>
												<span>耗电量(度)：{{item.consumption}}</span>
											</div>
											<div class="switch">
												<div>
													<el-switch :disabled="!IsOnLine || !item.online" v-model="item.state" on-color="#13ce66" :on-text="$t('message.on')" :off-text="$t('message.off')" @change="controlAirOnOff(item)">
													</el-switch>
													<el-switch :disabled="!IsOnLine || !item.online" v-model="item.state1" on-color="#13ce66" on-text="通电" off-text="断电" @change="controlAirSource(item)">
													</el-switch>
												</div>
											</div>
											<div class="switch">
												<div>
													<el-radio-group :disabled="!IsOnLine || !item.online" v-model="item.workmodel" @change="changeWorkModel(item)">
														<el-radio label="c">制冷</el-radio>
														<el-radio label="h">制热</el-radio>
													</el-radio-group>
												</div>
											</div>
										</div>
										<div class="section-right" style="text-align: center;width: 50%">
											<div class="switch">
												<el-button :disabled="item.temperature <= 16 || !IsOnLine || !item.online" type="danger" size="small" @click="controlAirCooling(item)"><i class="fa fa-long-arrow-down" style="padding-right: 3px"></i>降温</el-button>
												<el-button :disabled="item.temperature >= 30 || !IsOnLine || !item.online" type="success" size="small" @click="controlAirHeating(item)"><i class="fa fa-long-arrow-up" style="padding-right: 3px"></i>升温</el-button>
											</div>
											<div class="switch">
												<el-slider :disabled="!IsOnLine || !item.online" style="width:95%;padding-left: 10px" :max="30" :min="16" v-model="item.temperature" @change="adjustTemperature(item)"></el-slider>
											</div>
										</div>
									</div>
								</div>
							</el-col>
						</el-row>
					</div>
				</el-col>
				<!--无线网关传感器-->
				<!-- <el-col :span="24" style="padding-top: 5px" v-if="zbSensorDatas&&zbSensorDatas.length>0">
					<div class="bg-purple">
						<div class="panel-title">
							<span style="width: 70%">无线网关传感器</span>
							<img class="title-img" v-bind:src="imgUrl">
						</div>
						<el-row :gutter="5">
							<el-col :span="12" style="display: flex" v-for="item in zbSensorDatas">
								<div style="margin-top: 3px;" class="grid-content1 bg-purple">
									<div class="detail-section2">
										<div class="section-top2">
											<div style="padding: 0 3px">
												<span style="font-weight: bold;">{{item.name}}</span>
											</div>
										</div>
										<el-row :gutter="10" style="width: auto;">
											<el-col :span="24" v-if="item.illumination && item.illumination.length > 0" v-for="subItem in item.illumination">
												<div class="section-bottom2">
													<div class="section-bottom3">
														<div class="section-left3">
															<div class="detail-title">
																<div>
																	<i class="iconfont icon-guangzhao" style="color: #13ce66"></i>
																</div>
																<div>
																	<small>{{subItem.name}}(lx):&nbsp;{{subItem.val}}</small>
																</div>
															</div>
														</div>
													</div>
												</div>
											</el-col>
											<el-col :span="12" v-if="item.temperature && item.temperature.length > 0" v-for="subItem in item.temperature">
												<div class="section-bottom2">
													<div class="section-bottom3">
														<div class="section-left3">
															<div class="detail-title">
																<div>
																	<i class="iconfont icon-wenduji on" style="color: #13ce66"></i>
																</div>
																<div>
																	<small>{{subItem.name}}(℃):&nbsp;{{subItem.val}}</small>
																</div>
															</div>
														</div>
													</div>
												</div>
											</el-col>
											<el-col :span="12" v-if="item.humidity && item.humidity.length > 0" v-for="subItem in item.humidity">
												<div class="section-bottom2">
													<div class="section-bottom3">
														<div class="section-left3">
															<div class="detail-title">
																<div>
																	<i class="iconfont icon-shiduji on" style="color: #13ce66"></i>
																</div>
																<div>
																	<small>{{subItem.name}}(%):&nbsp;{{subItem.val}}</small>
																</div>
															</div>
														</div>
													</div>
												</div>
											</el-col>
											<el-col :span="24" v-if="item.meter && item.meter.length > 0" v-for="subItem in item.meter">
												<div class="section-bottom2" style="width: 100%">
													<div class="section-bottom3" style="width: 100%">
														<div class="section-left3">
															<div class="detail-title">
																<div style="text-align: center;font-weight: bold">
																	<small>{{subItem.name}}</small>
																</div>
																<div>
																	<i class="iconfont icon-dianliudianyabiao on" style="color: #13ce66"></i>
																</div>
															</div>
														</div>
														<div class="section-right3" style="padding-left: 10px;padding-top: 15px;">
															<div>
																<small>电压(V):&nbsp;{{subItem.u}}</small>
																<small>电流(mA):&nbsp;{{subItem.i}}</small>
															</div>
															<div>
																<small>功率(W):&nbsp;{{subItem.p}}</small>
																<small>电量(度):&nbsp;{{subItem.q}}</small>
															</div>
														</div>
													</div>
												</div>
											</el-col>
										</el-row>
									</div>
								</div>
							</el-col>
						</el-row>
					</div>
				</el-col> -->
				<!-- 照明设备-->
				<el-col :span="24" style="padding-top: 5px" v-if="zbDatas&&zbDatas.length>0">
					<div class="bg-purple">
						<div class="panel-title">
							<span style="width: 70%">无线网关设备</span>
							<img class="title-img" v-bind:src="imgUrl">
						</div>
						<el-row :gutter="5">
							<el-col :span="24" style="display: flex" v-for="item in zbDatas">
								<span style="font-weight: bold;"></span>
								<div style="margin-top: 5px;" class="grid-content1 bg-purple" v-if="item.onoff.length > 0">
									<div class="detail-section2">
										<div class="section-top2">
											<div style="padding: 0 3px">
												<span style="font-weight: bold;">{{item.name}}({{item.online ? '在线' : '离线'}})</span>
											</div>
										</div>
										<el-row :gutter="5" style="width: auto;">
											<el-col :span="isMobile ? 24 : 6" v-if="item.onoff && item.onoff.length > 0" v-for="subItem in item.onoff" v-loading="subItem.waitting">
												<div class="section-bottom2">
													<div class="section-bottom3">
														<div class="section-left3">
															<div class="detail-title">
																<i v-if="subItem.state" class="el-icon-eleg-icon_lightbulb_alt" style="color: #13ce66"></i>
																<i v-else style="color: #999999" class="el-icon-eleg-icon_lightbulb_alt"></i>
															</div>
															<div style="text-align: center;font-weight: bold">
																<small>{{subItem.name}}</small>
															</div>
														</div>
														<div class="section-right3">
															<div style="padding-top: 35px">
																<el-switch :disabled="!IsOnLine || !item.online" v-model="subItem.state" on-color="#13ce66" :on-text="$t('message.on')" :off-text="$t('message.off')" @change="controlZigBee(item,subItem)">
																</el-switch>
															</div>
														</div>
													</div>
												</div>
											</el-col>
										</el-row>
									</div>
								</div>
								<div style="margin-top: 5px;" class="grid-content1 bg-purple" v-if="item.illumination.length > 0">
									<div class="detail-section2">
										<div class="section-top2">
											<div style="padding: 0 3px">
												<span style="font-weight: bold;">{{item.name}}</span>
											</div>
										</div>
										<el-row :gutter="5" style="width: auto;">
											<el-col :span="isMobile ? 24 : 12" v-for="subItem in item.illumination">
												<div class="section-bottom2">
													<div class="section-bottom3">
														<div class="section-left3">
															<div class="detail-title">
																<div>
																	<i class="iconfont icon-guangzhao" style="color: #13ce66"></i>
																</div>
																<div>
																	<small>光照强度(lx):&nbsp;{{subItem.val}}</small>
																</div>
															</div>
														</div>
													</div>
												</div>
											</el-col>
										</el-row>
									</div>
								</div>
								<div style="margin-top: 5px;" class="grid-content1 bg-purple" v-if="item.temperature.length > 0 || item.humidity.length > 0">
									<div class="detail-section2">
										<div class="section-top2">
											<div style="padding: 0 3px">
												<span style="font-weight: bold;">{{item.name}}</span>
											</div>
										</div>
										<el-row :gutter="5" style="width: auto;">
											<el-col :span="isMobile ? 24 : 12" v-if="item.temperature && item.temperature.length > 0" v-for="subItem in item.temperature">
												<div class="section-bottom2">
													<div class="section-bottom3">
														<div class="section-left3">
															<div class="detail-title">
																<div>
																	<i class="iconfont icon-wenduji on" style="color: #13ce66"></i>
																</div>
																<div>
																	<small>{{subItem.name}}(℃):&nbsp;{{subItem.val}}</small>
																</div>
															</div>
														</div>
													</div>
												</div>
											</el-col>
											<el-col :span="isMobile ? 24 : 12" v-if="item.humidity && item.humidity.length > 0" v-for="subItem in item.humidity">
												<div class="section-bottom2">
													<div class="section-bottom3">
														<div class="section-left3">
															<div class="detail-title">
																<div>
																	<i class="iconfont icon-shiduji on" style="color: #13ce66"></i>
																</div>
																<div>
																	<small>{{subItem.name}}(%):&nbsp;{{subItem.val}}</small>
																</div>
															</div>
														</div>
													</div>
												</div>
											</el-col>
										</el-row>
									</div>
								</div>
							</el-col>
						</el-row>
					</div>
				</el-col>
				<!-- 继电器-->
				<el-col :span="24" style="padding-top: 5px" v-if="relay10Datas&&relay10Datas.length>0">
					<div class="bg-purple">
						<div class="panel-title">
							<span style="width: 70%">继电器</span>
							<img class="title-img" v-bind:src="imgUrl">
						</div>
						<el-row :gutter="5">
							<el-col :span="24" style="display: flex" v-for="item in relay10Datas">
								<div style="margin-top: 5px;" class="grid-content1 bg-purple" v-loading="item.waitting">
									<div class="detail-section2">
										<div class="section-top2">
											<div style="padding: 0 3px">
												<span style="font-weight: bold;padding-right: 10px">{{item.name}}</span>
												<el-button type="success" size="small" @click="openRelay10(item)">开启</el-button>
												<el-button type="danger" size="small" @click="closeRelay10(item)">关闭</el-button>
											</div>
										</div>
										<el-row :gutter="5" style="width: auto;">
											<el-col :span="isMobile ? 24 : 6" v-if="item.func && item.func.length > 0" v-for="subItem in item.func">
												<div class="section-bottom2">
													<div class="section-bottom3" v-loading="subItem.waitting">
														<div class="section-left3">
															<div style="text-align: center;font-weight: bold">
																<small>{{subItem.port}}</small>
															</div>
															<div class="detail-title">
																<i v-if="subItem.status" class="iconfont icon-jidianqi on" style="color: rgb(19, 206, 102)"></i>
																<i v-else class="iconfont icon-jidianqi"></i>
															</div>
														</div>
														<div class="section-right3">
															<div style="padding-top: 35px">
																<el-switch :disabled="!IsOnLine" v-model="subItem.status" on-color="#13ce66" on-text="开启" off-text="关闭" @change="controlRelay10(item, subItem)">
																</el-switch>
															</div>
														</div>
													</div>
												</div>
											</el-col>
										</el-row>
									</div>
								</div>
							</el-col>
						</el-row>
					</div>
				</el-col>
			</el-row>
		</el-col>
		<el-col :span="isMobile ? 24 : 12">
			<!-- 信号源 TC1000-->
			<el-col :span="24" style="padding-top: 5px;padding-right: 0px" v-if="this.templateObj.model === 'TC1000'">
				<div class="bg-purple">
					<div class="panel-title">
						<span style="width: 70%">信号源</span>
						<img class="title-img" v-bind:src="imgUrl">
					</div>
					<el-row :gutter="5" v-loading="vga1Obj.waitting">
						<el-col :span="isMobile ? 24 : 8" style="margin-top: 3px;">
							<div class="grid-content1 bg-purple">
								<div class="detail-section">
									<div class="section-left">
										<div class="detail-title">
											<i v-if="statusDatas.vga===1" class="fa fa-map-marker" style="color: #13ce66"></i>
											<i style="color: #999999" v-else class="fa fa-map-marker"></i>
										</div>
									</div>
									<div class="section-right">
										<div>
											<small style="font-size: 15px;font-weight: bold">本地信号源</small>
										</div>
										<div style="padding-top: 10px">
											<el-tag v-if="statusDatas.vga===1" type="success">已切换</el-tag>
											<el-button :disabled="!IsOnLine" v-else type="primary" size="small" @click="changeLocalVGA">切 换
											</el-button>
										</div>
									</div>
								</div>
							</div>
						</el-col>
						<el-col :span="isMobile ? 24 : 8" style="margin-top: 3px;">
							<div class="grid-content1 bg-purple">
								<div class="detail-section">
									<div class="section-left">
										<div class="detail-title">
											<i v-if="statusDatas.vga===2" class="fa fa-desktop" style="color: #13ce66"></i>
											<i v-else style="color: #999999" class="fa fa-desktop"></i>
										</div>
									</div>
									<div class="section-right">
										<div>
											<small style="font-size: 15px;font-weight: bold">台式电脑</small>
										</div>
										<div style="padding-top: 10px">
											<el-tag v-if="statusDatas.vga===2" type="success">已切换</el-tag>
											<el-button :disabled="!IsOnLine" v-else type="primary" size="small" @click="changeDesktopVGA">切 换
											</el-button>
										</div>
									</div>
								</div>
							</div>
						</el-col>
						<el-col :span="isMobile ? 24 : 8" style="margin-top: 3px;">
							<div class="grid-content1 bg-purple">
								<div class="detail-section">
									<div class="section-left">
										<div class="detail-title">
											<i v-if="statusDatas.vga===3" class="fa fa-laptop" style="color: #13ce66"></i>
											<i v-else style="color: #999999" class="fa fa-laptop"></i>
										</div>
									</div>
									<div class="section-right">
										<div>
											<small style="font-size: 15px;font-weight: bold">笔记本电脑</small>
										</div>
										<div style="padding-top: 10px">
											<el-tag v-if="statusDatas.vga===3" type="success">已切换</el-tag>
											<el-button :disabled="!IsOnLine" v-else type="primary" size="small" @click="changeLaptopVGA">切 换
											</el-button>
										</div>
									</div>
								</div>
							</div>
						</el-col>
						<el-col :span="isMobile ? 24 : 8" style="margin-top: 3px;">
							<div class="grid-content1 bg-purple">
								<div class="detail-section">
									<div class="section-left">
										<div class="detail-title">
											<i v-if="statusDatas.vga===5" class="iconfont icon-shipinzhantai" style="color: #13ce66"></i>
											<i v-else style="color: #999999" class="iconfont icon-shipinzhantai"></i>
										</div>
									</div>
									<div class="section-right">
										<div>
											<small style="font-size: 15px;font-weight: bold">视频展台</small>
										</div>
										<div style="padding-top: 10px">
											<el-tag v-if="statusDatas.vga===5" type="success">已切换</el-tag>
											<el-button :disabled="!IsOnLine" v-else type="primary" size="small" @click="changeZhantaiVGA">切 换
											</el-button>
										</div>
									</div>
								</div>
							</div>
						</el-col>
						<el-col :span="isMobile ? 24 : 8" style="margin-top: 3px;">
							<div class="grid-content1 bg-purple">
								<div class="detail-section">
									<div class="section-left">
										<div class="detail-title">
											<i v-if="statusDatas.vga===4" class="fa fa-ellipsis-h" style="color: #13ce66"></i>
											<i v-else style="color: #999999" class="fa fa-ellipsis-h"></i>
										</div>
									</div>
									<div class="section-right">
										<div>
											<small style="font-size: 15px;font-weight: bold">其他</small>
										</div>
										<div style="padding-top: 10px">
											<el-tag v-if="statusDatas.vga===4" type="success">已切换</el-tag>
											<el-button :disabled="!IsOnLine" v-else type="primary" size="small" @click="changeOtherVGA">切 换
											</el-button>
										</div>
									</div>
								</div>
							</div>
						</el-col>
					</el-row>
				</div>
			</el-col>
			<!-- 信号源 TC2000-->
			<el-col :span="24" style="padding-top: 5px;padding-right: 0px" v-if="this.templateObj.model === 'TC2000'">
				<div class="bg-purple">
					<div class="panel-title">
						<span style="width: 70%">信号源</span>
						<img class="title-img" v-bind:src="imgUrl">
					</div>
					<el-row :gutter="5" v-loading="vga2Obj.waitting">
						<!-- <el-col :span="8" style="margin-top: 3px;">
							<div class="grid-content1 bg-purple">
								<div class="detail-section">
									<div class="section-left">
										<div class="detail-title">
											<i v-if="statusDatas.vga===0" class="fa fa-ellipsis-h" style="color: #13ce66"></i>
											<i v-else style="color: #999999" class="fa fa-ellipsis-h"></i>
										</div>
									</div>
									<div class="section-right">
										<div>
											<small style="font-size: 15px;font-weight: bold">无</small>
										</div>
										<div style="padding-top: 10px">
											<el-tag v-if="statusDatas.vga===0" type="success">已切换</el-tag>
											<el-button :disabled="!IsOnLine" v-else type="primary" size="small" @click="changeNoVGA">切 换
											</el-button>
										</div>
									</div>
								</div>
							</div>
						</el-col> -->
						<el-col :span="isMobile ? 24 : 8" style="margin-top: 3px;">
							<div class="grid-content1 bg-purple">
								<div class="detail-section">
									<div class="section-left">
										<div class="detail-title">
											<i v-if="statusDatas.vga===1" class="fa fa-map-marker" style="color: #13ce66"></i>
											<i style="color: #999999" v-else class="fa fa-map-marker"></i>
										</div>
									</div>
									<div class="section-right">
										<div>
											<small style="font-size: 15px;font-weight: bold">本地信号源</small>
										</div>
										<div style="padding-top: 10px">
											<el-tag v-if="statusDatas.vga===1" type="success">已切换</el-tag>
											<el-button :disabled="!IsOnLine" v-else type="primary" size="small" @click="changeLocalVGA2">切 换
											</el-button>
										</div>
									</div>
								</div>
							</div>
						</el-col>
						<el-col :span="isMobile ? 24 : 8" style="margin-top: 3px;">
							<div class="grid-content1 bg-purple">
								<div class="detail-section">
									<div class="section-left">
										<div class="detail-title">
											<i v-if="statusDatas.vga===2" class="fa fa-desktop" style="color: #13ce66"></i>
											<i v-else style="color: #999999" class="fa fa-desktop"></i>
										</div>
									</div>
									<div class="section-right">
										<div>
											<small style="font-size: 15px;font-weight: bold">电脑</small>
										</div>
										<div style="padding-top: 10px">
											<el-tag v-if="statusDatas.vga===2" type="success">已切换</el-tag>
											<el-button :disabled="!IsOnLine" v-else type="primary" size="small" @click="changeComputerVGA">切 换
											</el-button>
										</div>
									</div>
								</div>
							</div>
						</el-col>
						<el-col :span="isMobile ? 24 : 8" style="margin-top: 3px;">
							<div class="grid-content1 bg-purple">
								<div class="detail-section">
									<div class="section-left">
										<div class="detail-title">
											<i v-if="statusDatas.vga===3" class="el-icon-eleg-icon_flowchart" style="color: #13ce66"></i>
											<i v-else style="color: #999999" class="el-icon-eleg-icon_flowchart"></i>
										</div>
									</div>
									<div class="section-right">
										<div>
											<small style="font-size: 15px;font-weight: bold">外接</small>
										</div>
										<div style="padding-top: 10px">
											<el-tag v-if="statusDatas.vga===3" type="success">已切换</el-tag>
											<el-button :disabled="!IsOnLine" v-else type="primary" size="small" @click="changeOutVGA">切 换
											</el-button>
										</div>
									</div>
								</div>
							</div>
						</el-col>
						<el-col :span="isMobile ? 24 : 8" style="margin-top: 3px;">
							<div class="grid-content1 bg-purple">
								<div class="detail-section">
									<div class="section-left">
										<div class="detail-title">
											<i v-if="statusDatas.vga===4" class="iconfont icon-shipinzhantai" style="color: #13ce66"></i>
											<i v-else style="color: #999999" class="iconfont icon-shipinzhantai"></i>
										</div>
									</div>
									<div class="section-right">
										<div>
											<small style="font-size: 15px;font-weight: bold">视频展台</small>
										</div>
										<div style="padding-top: 10px">
											<el-tag v-if="statusDatas.vga===4" type="success">已切换</el-tag>
											<el-button :disabled="!IsOnLine" v-else type="primary" size="small" @click="changeZhantaiVGA2">切 换
											</el-button>
										</div>
									</div>
								</div>
							</div>
						</el-col>
					</el-row>
				</div>
			</el-col>
			<!-- 红外遥控 -->
			<el-col :span="24" style="padding-top:5px" v-if="irDatas&&irDatas.length>0">
				<div class="bg-purple">
					<div class="panel-title">
						<span style="width: 70%">红外遥控</span>
						<img class="title-img" v-bind:src="imgUrl">
					</div>
					<el-row :gutter="5">
						<el-col :span="isMobile ? 24 : 12" style="margin-top: 3px;" v-for="item in irDatas">
							<div v-if="item.type === 0" class="grid-content1 bg-purple" v-loading="item.waitting">
								<div class="detail-section">
									<div class="section-left" style="width: 70%">
										<div>
											<span style="font-weight: bold;font-size: 15px">{{item.name}}</span>
										</div>
										<div class="detail-title">
											<i class="iconfont icon-hongwaiyaokong on" style="color: rgb(19, 206, 102)"></i>
										</div>
									</div>
									<div class="section-right" style="text-align: center">
										<div>
											<el-button :disabled="!IsOnLine" type="success" size="small" @click="controlIrOn(item)">开启</el-button>
										</div>
										<div>
											<el-button :disabled="!IsOnLine" type="danger" size="small" @click="controlIrOff(item)">关闭</el-button>
										</div>
									</div>
								</div>
							</div>

							<div v-else class="grid-content1 bg-purple" v-loading="item.waitting">
								<div class="detail-section">
									<div class="section-left" style="width: 70%">
										<div>
											<span style="font-weight: bold;font-size: 15px">{{item.name}}</span>
										</div>
										<div class="detail-title">
											<i class="iconfont icon-hongwaiyaokong on" style="color: rgb(19, 206, 102)"></i>
										</div>
									</div>
									<div class="section-right" style="text-align: center">
										<div>
											<el-button :disabled="!IsOnLine" type="success" size="small" @click="controlIrOn(item)">开启</el-button>
										</div>
										<div>
											<el-button :disabled="!IsOnLine" type="danger" size="small" @click="controlIrOff(item)">关闭</el-button>
										</div>
									</div>
								</div>
							</div>
						</el-col>
					</el-row>
				</div>
			</el-col>
			<!-- 继电设备 -->
			<el-col :span="24" style="padding-top: 5px;padding-right: 0px" v-if="relayDatas&&relayDatas.length>0">
				<div class="bg-purple">
					<div class="panel-title">
						<span style="width: 70%">继电设备</span>
						<img class="title-img" v-bind:src="imgUrl">
					</div>
					<el-row :gutter="5" v-loading="relayControlLoading">
						<el-col :span="isMobile ? 24 : 12" style="margin-top: 3px;" v-for="item in relayDatas">
							<div class="grid-content1 bg-purple">
								<div class="detail-section">
									<div class="section-left" style="width: 60%">
										<div>
											<span style="font-weight: bold">{{item.name}}</span>
										</div>
										<div class="detail-title">
											<i class="iconfont icon-jidianqi on" style="color: rgb(19, 206, 102)"></i>
										</div>
									</div>
									<div class="section-right" v-if="item.func && item.func.length > 0">
										<el-dropdown size="small" split-button type="primary" @command="handleCommand">
											控制开关
											<el-dropdown-menu slot="dropdown">
												<el-dropdown-item v-for="subItem in item.func" :command="subItem">{{subItem.name}}</el-dropdown-item>
											</el-dropdown-menu>
										</el-dropdown>
										<!-- <div v-for="subItem in item.func" style="text-align: center">
											<el-button :disabled="!IsOnLine" type="primary" size="small" @click="controlRelay(item,subItem)">{{subItem.name}}</el-button>
										</div> -->
									</div>
								</div>
							</div>
						</el-col>
					</el-row>
				</div>
			</el-col>
			<!-- led显示屏 -->
			<el-col :span="24" style="padding-top: 5px;padding-right: 0px" v-if="leddigsigDatas&&leddigsigDatas.length>0">
				<div class="bg-purple">
					<div class="panel-title">
						<span style="width: 70%">LED显示屏</span>
						<img class="title-img" v-bind:src="imgUrl">
					</div>
					<el-row :gutter="5">
						<el-col :span="24" style="margin-top: 3px;" v-for="item in leddigsigDatas">
							<div class="grid-content1 bg-purple">
								<div class="detail-section">
									<div class="section-left" style="width: 35%">
										<div>
											<span style="font-weight: bold">{{item.name}}</span>
										</div>
										<div class="detail-title">
											<i class="fa fa-clone" style="color: rgb(19, 206, 102)"></i>
										</div>
									</div>
									<div class="section-right" style="text-align: left">
										<div>
											<small>类型：{{item.type === 0 ? '显示文本' : (item.type === 1 ? '显示倒计时' : '显示时间')}}</small>
										</div>
										<div>
											<small>显示文本：</small>
											<small v-if="item.showstr != ''">{{item.showstr}}</small>
											<small v-else><el-tag type="warning">未设置</el-tag></small>
										</div>
										<div>
											<small>倒计时结束时间：</small>
											<small v-if="item.enddatetime != ''">{{item.enddatetime}}</small>
											<small v-else><el-tag type="warning">未设置</el-tag></small>
										</div>
									</div>
								</div>
							</div>
						</el-col>
					</el-row>
				</div>
			</el-col>
			<!-- 投影仪 -->
			<el-col :span="24" style="padding-top: 5px;padding-right: 0px" v-if="projectorDatas&&projectorDatas.length>0">
				<div class="bg-purple">
					<div class="panel-title">
						<span style="width: 70%">投影机/一体机</span>
						<img class="title-img" v-bind:src="imgUrl">
					</div>
					<el-row :gutter="5">
						<el-col :span="isMobile ? 24 : 12" style="margin-top: 3px;" v-for="item in projectorDatas">
							<div class="grid-content1 bg-purple" v-loading="item.waitting">
								<div class="detail-section">
									<div class="section-left">
										<div class="detail-title">
											<i v-if="item.onoff" class="iconfont icon-touyingji" style="color: #13ce66"></i>
											<i v-else style="color: #999999" class="iconfont icon-touyingji"></i>
										</div>
										<div class="switch">
											<el-switch :disabled="!IsOnLine || !item.online" v-model="item.onoff" on-color="#13ce66" :on-text="$t('message.on')" :off-text="$t('message.off')" @change="controlProjector(item)">
											</el-switch>
										</div>
									</div>
									<div class="section-right">
										<div>
											<span style="font-weight: bold">{{item.name}}({{item.online ? '在线' : '离线'}})</span>
										</div>
										<div>
											<small>使用时长(H)：{{item.hourused}}</small>
										</div>
									</div>
								</div>
							</div>
						</el-col>
					</el-row>
				</div>
			</el-col>
			<!--传感器-->
			<el-col :span="24" style="padding-top: 5px;padding-right: 0px" v-if="sensorDatas&&sensorDatas.length>0">
				<div class="bg-purple">
					<div class="panel-title">
						<span style="width: 70%">传感器</span>
						<img class="title-img" v-bind:src="imgUrl">
					</div>
					<el-row :gutter="5">
						<el-col :span="isMobile ? 24 : 12" style="display: flex;margin-top: 3px;" v-for="item in sensorDatas">
							<div class="grid-content1 bg-purple" style="height: 80px;" v-if="item.type === 3">
								<div class="detail-section">
									<div class="section-left">
										<div class="detail-title">
											<i class="fa fa-volume-up" style="color: #13ce66"></i>
										</div>
									</div>
									<div class="section-right">
										<div>
											<span style="font-weight: bold">{{item.name}}</span>
										</div>
										<div>
											<small>音量:&nbsp;{{item.volume}}</small>
										</div>
									</div>
								</div>
							</div>
							<div class="grid-content1 bg-purple" style="height: 80px;" v-if="item.type === 1">
								<div class="detail-section">
									<div class="section-left">
										<div class="detail-title">
											<i class="iconfont icon-guangzhao" style="color: #13ce66"></i>
										</div>
									</div>
									<div class="section-right">
										<div>
											<span style="font-weight: bold">{{item.name}}</span>
										</div>
										<div>
											<small>光照强度(lx):&nbsp;{{item.illumination}}</small>
										</div>
									</div>
								</div>
							</div>
							<div class="grid-content1 bg-purple" v-if="item.type === 0" style="height: 80px;">
								<div class="detail-section">
									<div class="section-left">
										<div class="detail-title">
											<i class="iconfont icon-PM" style="color: #13ce66"></i>
										</div>
									</div>
									<div class="section-right">
										<div>
											<span style="font-weight: bold">{{item.name}}</span>
										</div>
										<div>
											<small>PM 2.5:&nbsp;{{item.pm}}</small>
										</div>
									</div>
								</div>
							</div>
							<div class="grid-content1 bg-purple" style="height: 80px;" v-if="item.type === 2">
								<div class="detail-section2">
									<div class="section-top2">
										<div style="padding: 0 3px">
											<span style="font-weight: bold;">{{item.name}}</span>
										</div>
									</div>
									<el-row :gutter="5" style="width: auto;">
										<el-col :span="isMobile ? 24 : 12">
											<div class="section-bottom2">
												<div class="section-bottom3">
													<div class="section-left3">
														<div class="detail-title">
															<i class="iconfont icon-wenduji" style="color: #13ce66"></i>
														</div>
													</div>
													<div class="section-right3">
														<div>
															<small>温度(℃)</small>
														</div>
														<div>
															<small>{{item.temperature}}</small>
														</div>
													</div>
												</div>
											</div>
										</el-col>
										<el-col :span="isMobile ? 24 : 12">
											<div class="section-bottom2">
												<div class="section-bottom3">
													<div class="section-left3">
														<div class="detail-title">
															<i class="iconfont icon-shiduji" style="color: #13ce66"></i>
														</div>
													</div>
													<div class="section-right3">
														<div>
															<small>湿度(%)</small>
														</div>
														<div>
															<small>{{item.humidity}}</small>
														</div>
													</div>
												</div>
											</div>
										</el-col>
									</el-row>
								</div>
							</div>
						</el-col>
					</el-row>
				</div>
			</el-col>
			<!-- 电源管理器 -->
			<el-col :span="24" style="padding-top: 5px;padding-right: 0px" v-if="pduDatas&&pduDatas.length>0">
				<div class="bg-purple">
					<div class="panel-title">
						<span style="width: 70%">电源管理器</span>
						<img class="title-img" v-bind:src="imgUrl">
					</div>
					<el-row :gutter="5">
						<el-col style="width: auto;display: flex;margin-top: 3px" v-for="item in pduDatas">
							<div class="grid-content1 bg-purple">
								<div class="detail-section2" style="height: 100%;">
									<div class="section-top2">
										<div style="padding: 0 3px">
											<span style="font-weight: bold">{{item.name}}({{item.online ? '在线' : '离线'}})</span>
										</div>
									</div>
									<div class="section-bottom2" v-if="item.socket && item.socket.length > 0">
										<el-row :gutter="5">
											<el-col :span="isMobile ? 24 : 12" v-for="subItem in item.socket" v-loading="subItem.waitting">
												<div style="padding-left: 10px" class="section-bottom3">
													<div class="section-left3" style="text-align: center;">
														<div>
															<small style="font-size: 14px;font-weight: bold">{{subItem.name}}</small>
														</div>
														<div class="detail-title">
															<i v-if="subItem.onoff" class="iconfont icon-chazhuo" style="color: #13ce66"></i>
															<i v-else style="color: #999999" class="iconfont icon-chazhuo"></i>
														</div>
														<div class="switch">
															<el-switch :disabled="!IsOnLine || !item.online" v-model="subItem.onoff" on-color="#13ce66" :on-text="$t('message.on')" :off-text="$t('message.off')" @change="controlPdu(item,subItem)"></el-switch>
														</div>
													</div>
													<div class="section-right3" style="text-align: left;padding-top: 20px">
														<div>
															<small>{{$t('message.current')+':&nbsp;'}}</small>
															<small>{{subItem.i}}</small>
														</div>
														<div>
															<small>{{$t('message.voltage')+':&nbsp;'}}</small>
															<small>{{subItem.u}}</small>
														</div>
														<div>
															<small>{{$t('message.powerConsumption')+'	:&nbsp;'}}</small>
															<small>{{subItem.consumption}}</small>
														</div>
													</div>
												</div>
											</el-col>
										</el-row>
									</div>
									<div v-else class="section-bottom2">
										<div style="padding-top: 25px">
											<el-tag>暂无数据</el-tag>
										</div>
									</div>
								</div>
							</div>
						</el-col>
					</el-row>
				</div>
			</el-col>
		</el-col>
	</el-row>
	<!-- 修改名称 -->
	<el-dialog title="设备重命名" v-model="renameDeviceDialog" :close-on-click-modal="false" :class="[dialog-tiny-width]">
		<span>
			<div style="margin-top: 15px">
				<small style="font-size: 15px;font-weight: bold;width: 25%">设备名称：</small>
				<el-input style="width: 73%" size="small" v-model="changeNameObj.deviceName"></el-input>
			</div>
		</span>
		<span slot="footer" class="dialog-footer">
			<el-button v-if="!changeNameObj.waitting" type="primary" @click="rename">确 定</el-button>
			<i v-else class="el-icon-loading" style="font-size:25px"></i>
		</span>
	</el-dialog>
	<el-dialog title="设备故障记录" v-model="failureDialog" :class="[dialog-large-width]">
		<div style="padding-bottom: 2px">
			<span style="font-size: 13px;font-weight: bold">{{$t('message.start')}}</span>
			<el-date-picker :editable="false" :clearable="false" size="small" type="date" v-model="failureStartTime" placeholder="选择起始日期" @change="changeFailureStartTime"></el-date-picker>
			<span style="font-size: 13px;font-weight: bold">{{$t('message.end')}}</span>
			<el-date-picker :editable="false" :clearable="false" size="small" type="date" v-model="failureEndTime" placeholder="选择结束日期" @change="changeFailureEndTime"></el-date-picker>
		</div>
		<el-table border :data="failureDatas">
			<el-table-column :show-overflow-tooltip="true" type="selection"></el-table-column>
			<el-table-column :show-overflow-tooltip="true" label="设备" align="center" prop="name"></el-table-column>
			<el-table-column :show-overflow-tooltip="true" label="故障代码" align="center" prop="code"></el-table-column>
			<el-table-column :show-overflow-tooltip="true" label="故障时间" align="center" prop="time"></el-table-column>
			<el-table-column :show-overflow-tooltip="true" label="故障描述" align="center" prop="desc">
			</el-table-column>
		</el-table>
		<div class="block" style="text-align:right">
			<el-pagination @size-change="handleFailureSizeChange" @current-change="handleFailureCurrentChange" :current-page="failureCurrentPage" :page-size="failurePageSize" :page-sizes="[10, 20, 30, 40, 50]" layout="total,sizes, prev, pager, next, jumper" :total="failureTotalSize">
			</el-pagination>
		</div>
	</el-dialog>
	<el-dialog title="设备异常报告" v-model="expDialog" :class="[dialog-large-width]">
		<div style="padding-bottom: 2px">
			<span style="font-size: 13px;font-weight: bold">{{$t('message.start')}}</span>
			<el-date-picker :editable="false" :clearable="false" size="small" type="date" v-model="expStartTime" placeholder="选择起始日期" @change="changeExpStartTime"></el-date-picker>
			<span style="font-size: 13px;font-weight: bold">{{$t('message.end')}}</span>
			<el-date-picker :editable="false" :clearable="false" size="small" type="date" v-model="expEndTime" placeholder="选择结束日期" @change="changeExpEndTime"></el-date-picker>
		</div>
		<el-table border :data="expDatas">
			<el-table-column :show-overflow-tooltip="true" type="index" align="center"></el-table-column>
			<el-table-column :show-overflow-tooltip="true" label="设备" align="center" prop="name"></el-table-column>
			<el-table-column :show-overflow-tooltip="true" label="应用名称" align="center" prop="appname"></el-table-column>
			<el-table-column :show-overflow-tooltip="true" label="应用版本" align="center" prop="appver"></el-table-column>
			<el-table-column :show-overflow-tooltip="true" label="异常时间" align="center" prop="time"></el-table-column>
			<el-table-column :show-overflow-tooltip="true" label="异常描述" align="center" prop="desc">
			</el-table-column>
		</el-table>
		<div class="block" style="text-align:right">
			<el-pagination @size-change="handleExpSizeChange" @current-change="handleExpCurrentChange" :current-page="expCurrentPage" :page-size="expPageSize" :page-sizes="[10, 20, 30, 40, 50]" layout="total,sizes, prev, pager, next, jumper" :total="expTotalSize">
			</el-pagination>
		</div>
	</el-dialog>
</div>
</template>

<script>
	import $ from 'jquery';
	import swf from '../../../../assets/js/swfobject.js'
	import headerOpreate from '../../../../components/headerOpreate'
	import { GloabFun, HttpServer } from '../../../../assets/js/common.js'
	import { Animation } from '../../../../assets/js/common.js'
	import imgDefault from '../../../../assets/images/title-right.png'
	var date = new Date();
	var that = null;
	var flag = true;
	var TCDetailIntervalid = null;
	export default {
		components: {
			headerOpreate
		},
		data() {
			Date.prototype.format = function(format) {
				var date = {
					"M+": this.getMonth() + 1,
					"d+": this.getDate()
				};
				if(/(y+)/i.test(format)) {
					format = format.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
				}
				for(var k in date) {
					if(new RegExp("(" + k + ")").test(format)) {
						format = format.replace(RegExp.$1, RegExp.$1.length == 1 ?
							date[k] : ("00" + date[k]).substr(("" + date[k]).length));
					}
				}
				return format;
			}
			return {
				api: '',//不同型号不同接口
				imgUrl: imgDefault,
				volumeFlag: false,
				airFlag: false,
				pingTime: '',
				pduDatas: [], //电源管理器
				projectorDatas: [], //投影机
				zbDatas: [], //ZigBee无线设备
				relayDatas: [], //继电设备
				relayControlLoading: false,
				irDatas: [], //红外遥控
				cptDatas: [], //电脑设备
				airDatas: [], //空调数据
				zbzbSensorDatas: [], //无线网关传感器数据，需要从zb数据中筛选
				sensorDatas: [], //传感器数据
				leddigsigDatas: [],//LED显示屏数据
				relay10Datas: [],//继电器数据
				aioDatas: [],//一体机数据
				IsOnLine: false, //设备是否在线
				loading: false, //数据加载
				statusDatas: {},
				deviceData: [],
				renameDeviceDialog: false,
				//故障记录
				failureDialog: false,
				failureDatas: [],
				failureCurrentPage: 1,
				failurePageSize: 10,
				failureTotalSize: 0,
				failureStartTime: new Date((date.getTime() - 3600 * 1000 * 24 * 7)).format('yyyy-MM-dd') + ' 00:00:00',
				failureEndTime: date.format('yyyy-MM-dd') + ' 23:59:59',

				//异常报告
				expDialog: false,
				expDatas: [],
				expCurrentPage: 1,
				expPageSize: 10,
				expTotalSize: 0,
				expStartTime: new Date((date.getTime() - 3600 * 1000 * 24 * 7)).format('yyyy-MM-dd') + ' 00:00:00',
				expEndTime: date.format('yyyy-MM-dd') + ' 23:59:59',

				changeNameObj: {
					waitting: false
				},
				controlMicroPhoneObj: {
					waitting: false
				},
				controlVolumeObj: {
					// volume:0,
					waitting: false
				},
				vga1Obj: {
					waitting: false
				},
				vga2Obj: {
					waitting: false
				},
				classSetObj: {
					waitting: false
				},
				lockScreenObj: {
					waitting: false
				},
				previewObj: {
					waitting: false
				}
			}
		},
		props: {
			templateObj: {
				type: Object,
				default: {}
			}
		},
		methods: {
			executeAction(action) {
				if(action) {
					this[action]();
				}
			},

			openFailure() {
				this.getFailureDatas();
				this.failureDialog = true;
			},
			//查询设备故障记录
			getFailureDatas() {
				var param = {
					index: this.failureCurrentPage,
					pagesize: this.failurePageSize,
					sn: [this.templateObj.sn],
					begin: this.failureStartTime,
					end: this.failureEndTime,
					type: 2,
					filter: ''
				}
				HttpServer.httpPost.call(this, '/Api/Device/Failure', param, function(response) {}, function(response) {
					// console.log('故障信息',response);
					if(response.data.code === 0) {
						this.failureDatas = response.data.failure;
						this.failureTotalSize = response.data.totalcount;
					} else {
						this.$notify.error({
							title: '错误',
							message: response.data.msg,
							duration: 2500
						});
					}
				});
			},
			changeFailureStartTime(val) {
				this.failureStartTime = val + ' 00:00:00';
				this.getFailureDatas();
			},
			changeFailureEndTime(val) {
				this.failureEndTime = val + ' 23:59:59';
				this.getFailureDatas();
			},
			handleFailureCurrentChange(val) {
				this.failureCurrentPage = val;
				this.getFailureDatas();
			},
			handleFailureSizeChange(val) {
				this.failurePageSize = val;
				this.getFailureDatas();
			},
			openExp() {
				this.getExpDatas();
				this.expDialog = true;
			},
			getExpDatas() {
				var param = {
					index: this.expCurrentPage,
					pagesize: this.expPageSize,
					sn: [this.templateObj.sn],
					begin: this.expStartTime,
					end: this.expEndTime,
					type: 2,
					filter: ''
				}
				HttpServer.httpPost.call(this, '/Api/Device/AppException', param, function(response) {}, function(response) {
					if(response.data.code === 0) {
						this.expDatas = response.data.exp;
						this.expTotalSize = response.data.totalcount;
					} else {
						this.$notify.error({
							title: '错误',
							message: response.data.msg,
							duration: 2500
						});
					}
				})
			},
			changeExpStartTime(val) {
				this.expStartTime = val + ' 00:00:00';
				this.getExpDatas();
			},
			changeExpEndTime(val) {
				this.expEndTime = val + ' 23:59:59';
				this.getExpDatas();
			},
			handleExpCurrentChange(val) {
				this.expCurrentPage = val;
				this.getExpDatas();
			},
			handleExpSizeChange(val) {
				this.expPageSize = val;
				this.getExpDatas();
			},
			//修改名称
			changeName(row) {
				if(this.IsOnLine) {
					this.changeNameObj.deviceName = row.name;
					this.renameDeviceDialog = true;
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//上课
			startClass() {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid)
					this.$nextTick(function() {
						this.classSetObj.waitting = true;
						HttpServer.httpPost.call(this, '/Api/Peripheral/ClassSet', {
							sns: [this.templateObj.sn],
							operation: 1,
							UserId: parseInt(GloabFun.getKeyId())
						}, function(response) {}, function(response) {
							// console.log('上课',response);
							this.classSetObj.waitting = false;
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].code === 0 && response.data.response[0].sn == this.templateObj.sn) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							this.TCDetailIntervalid = setInterval(() => {
								this.getDatas();
							}, 5000)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//下课
			closeClass() {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid)
					this.$nextTick(function() {
						this.classSetObj.waitting = true;
						HttpServer.httpPost.call(this, '/Api/Peripheral/ClassSet', {
							sns: [this.templateObj.sn],
							operation: 0,
							UserId: parseInt(GloabFun.getKeyId())
						}, function(response) {}, function(response) {
							// console.log('下课',response);
							this.classSetObj.waitting = false;
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].code === 0 && response.data.response[0].sn == this.templateObj.sn) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							window.setTimeout(
								this.TCDetailIntervalid = setInterval(() => {
									this.getDatas();
								}, 5000), 5000
								)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//锁屏
			lockScreen() {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid)
					this.$nextTick(function() {
						this.lockScreenObj.waitting = true;
						HttpServer.httpPost.call(this, '/Api/Peripheral/LockScreen', {
							sns: [this.templateObj.sn],
							operation: 1,
							UserId: parseInt(GloabFun.getKeyId())
						}, function(response) {}, function(response) {
							// console.log('锁屏',response);
							this.lockScreenObj.waitting = false;
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].code === 0 && response.data.response[0].sn == this.templateObj.sn) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							window.setTimeout(
								this.TCDetailIntervalid = setInterval(() => {
									this.getDatas();
								}, 5000), 5000
								)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//解锁
			unLockScreen() {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid)
					this.$nextTick(function() {
						this.lockScreenObj.waitting = true;
						HttpServer.httpPost.call(this, '/Api/Peripheral/LockScreen', {
							sns: [this.templateObj.sn],
							operation: 0,
							UserId: parseInt(GloabFun.getKeyId())
						}, function(response) {}, function(response) {
							// console.log('解锁',response);
							this.lockScreenObj.waitting = false;
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].code === 0 && response.data.response[0].sn == this.templateObj.sn) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							window.setTimeout(
								this.TCDetailIntervalid = setInterval(() => {
									this.getDatas();
								}, 5000), 5000
								)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//修改名称
			rename() {
				HttpServer.httpPost.call(this,'/Api/Device/UpdateName', {
					sn: this.templateObj.sn,
					name: this.changeNameObj.deviceName
				},response => {}, response => {
					if(response.data.code === 0){
						this.$notify({
							title: '成功',
							message: '操作成功',
							type: 'success',
							duration: 2500
						});
						this.renameDeviceDialog = false
						this.deviceData[0].name = this.changeNameObj.deviceName
					}else{
						this.$notify.error({
							title: '错误',
							message: response.data.msg,
							duration: 2500
						});
					}
				})
			},
			//控制麦克风开关
			controlMicroPhone() {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid);
					this.$nextTick(function() {
						this.controlMicroPhoneObj.waitting = true;
						HttpServer.httpPost.call(this, '/Api/Peripheral/Microphone', {
							sns: [this.templateObj.sn],
							status: this.statusDatas.microphone ? 1 : 0,
							UserId: parseInt(GloabFun.getKeyId())
						}, function(response) {}, function(response) {
							this.controlMicroPhoneObj.waitting = false;
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].code === 0 && response.data.response[0].sn == this.templateObj.sn) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.statusDatas.microphone = !this.statusDatas.microphone;
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							window.setTimeout(
								this.TCDetailIntervalid = setInterval(() => {
									this.getDatas();
								}, 5000), 5000
								)
						})
					})
				} else {
					this.statusDatas.microphone = !this.statusDatas.microphone;
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//三代中控预监功能
			controlPreview() {
				clearInterval(this.TCDetailIntervalid)
				this.$nextTick(function() {
					this.previewObj.waitting = true;
					HttpServer.httpPost.call(this, '/Api/Peripheral/PreSupervision', {
						sns: [this.templateObj.sn],
						operation: this.statusDatas.preview ? 1 : 0,
						UserId: parseInt(GloabFun.getKeyId())
					}, function(response) {}, function(response) {
						this.previewObj.waitting = false;
						if(response.data.code === 0) {
							if(response.data.response.length > 0) {
								if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
									this.$notify({
										title: '成功',
										message: '操作成功',
										type: 'success',
										duration: 2500
									});
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作失败',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: '操作无响应',
									duration: 2500
								});
							}
						} else {
							this.$notify.error({
								title: '错误',
								message: response.data.msg,
								duration: 2500
							});
						}
						window.setTimeout(
							this.TCDetailIntervalid = setInterval(() => {
								this.getDatas();
							}, 5000), 5000
							)
					})
				})
			},
			//控制一体机
			controlAio(item, mem) {
				clearInterval(this.TCDetailIntervalid)
				this.$nextTick(function() {
					item.waitting = true;
					var operate = null;
					if(mem == 1){
						operate = item.aiostatus ? 1 : 0;
					}else if(mem == 2){
						operate = item.pcstatus ? 1 : 0;
					}else if(mem == 3){
						operate = item.microstatus ? 1 : 0;
					}else {
						operate = item.bluetoothstatus ? 1 : 0;
					}
					HttpServer.httpPost.call(this, '/Api/Peripheral/Aio', {
						sn: this.templateObj.sn,
  						devices: [
    						{
      							id: item.id,
      							target: mem
    						},
  						],
  						operate: operate,
  						UserId: parseInt(GloabFun.getKeyId())
					}, function(response) {}, function(response) {
						item.waitting = false;
						if(response.data.code === 0) {
							if(response.data.response.length > 0) {
								if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
									this.$notify({
										title: '成功',
										message: '操作成功',
										type: 'success',
										duration: 2500
									});
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作失败',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: '操作无响应',
									duration: 2500
								});
							}
						} else {
							this.$notify.error({
								title: '错误',
								message: response.data.msg,
								duration: 2500
							});
						}
						window.setTimeout(
							this.TCDetailIntervalid = setInterval(() => {
								this.getDatas();
							}, 5000), 5000
						)
					})
				})
			},
			//修改音量
			changeVolume() {
				if(this.IsOnLine) {
					if(this.volumeFlag) {
						clearInterval(this.TCDetailIntervalid)
						this.$nextTick(function() {
							this.controlVolumeObj.waitting = true;
							HttpServer.httpPost.call(this, '/Api/Peripheral/Volume', {
								sns: [this.templateObj.sn],
								volume: this.statusDatas.volume,
								UserId: parseInt(GloabFun.getKeyId())
							}, function(response) {}, function(response) {
								this.controlVolumeObj.waitting = false;
								if(response.data.code === 0) {
									if(response.data.response.length > 0) {
										if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
											this.$notify({
												title: '成功',
												message: '操作成功',
												type: 'success',
												duration: 2500
											});
										} else {
											this.$notify.error({
												title: '错误',
												message: '操作失败',
												duration: 2500
											});
										}
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作无响应',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: response.data.msg,
										duration: 2500
									});
								}
								window.setTimeout(
									this.TCDetailIntervalid = setInterval(() => {
										this.getDatas();
									}, 5000), 5000
									)
							})
						})
					}
				} else {
					// this.$notify({
					// 	title: this.$t('message.warning'),
					// 	message: '设备处于离线状态，不可控制。',
					// 	type: 'warning',
					// 	duration: 2500
					// });
				}
			},
			//静音
			controlQuiet() {
				clearInterval(this.TCDetailIntervalid)
				this.$nextTick(function() {
					this.controlVolumeObj.waitting = true;
					HttpServer.httpPost.call(this, '/Api/Peripheral/QuietControl', {
						sns: [this.templateObj.sn],
						operation: this.statusDatas.quiet ? 1 : 0,
						UserId: parseInt(GloabFun.getKeyId())
					}, function(response) {}, function(response) {
						this.controlVolumeObj.waitting = false;
						if(response.data.code === 0) {
							if(response.data.response.length > 0) {
								if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
									this.$notify({
										title: '成功',
										message: '操作成功',
										type: 'success',
										duration: 2500
									});
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作失败',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: '操作无响应',
									duration: 2500
								});
							}
						} else {
							this.$notify.error({
								title: '错误',
								message: response.data.msg,
								duration: 2500
							});
						}
						window.setTimeout(
							this.TCDetailIntervalid = setInterval(() => {
								this.getDatas();
							}, 5000), 5000
							)
					})
				})
			},
			/**
				TC1000信号源
				**/
			//切换本地信号源
			changeLocalVGA() {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid)
					this.$nextTick(function() {
						this.vga1Obj.waitting = true;
						HttpServer.httpPost.call(this, '/Api/Peripheral/SignalSource', {
							sns: [this.templateObj.sn],
							vgasource: 1,
							UserId: parseInt(GloabFun.getKeyId())
						}, function(response) {}, function(response) {
							this.vga1Obj.waitting = false;
							// console.log('切换本地信号源',response)
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							this.getDatas();
							this.TCDetailIntervalid = setInterval(() => {
								this.getDatas();
							}, 5000)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//切换台式电脑信号源
			changeDesktopVGA() {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid)
					this.$nextTick(function() {
						this.vga1Obj.waitting = true;
						HttpServer.httpPost.call(this, '/Api/Peripheral/SignalSource', {
							sns: [this.templateObj.sn],
							vgasource: 2,
							UserId: parseInt(GloabFun.getKeyId())
						}, function(response) {}, function(response) {
							this.vga1Obj.waitting = false;
							// console.log('切换台式电脑',response)
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							this.getDatas();
							this.TCDetailIntervalid = setInterval(() => {
								this.getDatas();
							}, 5000)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//切换笔记本电脑信号源
			changeLaptopVGA() {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid)
					this.$nextTick(function() {
						this.vga1Obj.waitting = true;
						HttpServer.httpPost.call(this, '/Api/Peripheral/SignalSource', {
							sns: [this.templateObj.sn],
							vgasource: 3,
							UserId: parseInt(GloabFun.getKeyId())
						}, function(response) {}, function(response) {
							this.vga1Obj.waitting = false;
							// console.log('切换笔记本电脑',response)
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							this.getDatas();
							this.TCDetailIntervalid = setInterval(() => {
								this.getDatas();
							}, 5000)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//切换视频展台信号源
			changeZhantaiVGA() {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid)
					this.$nextTick(function() {
						this.vga1Obj.waitting = true;
						HttpServer.httpPost.call(this, '/Api/Peripheral/SignalSource', {
							sns: [this.templateObj.sn],
							vgasource: 5,
							UserId: parseInt(GloabFun.getKeyId())
						}, function(response) {}, function(response) {
							this.vga1Obj.waitting = false;
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							this.getDatas();
							this.TCDetailIntervalid = setInterval(() => {
								this.getDatas();
							}, 5000)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//切换其他信号源
			changeOtherVGA() {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid)
					this.$nextTick(function() {
						this.vga1Obj.waitting = true;
						HttpServer.httpPost.call(this, '/Api/Peripheral/SignalSource', {
							sns: [this.templateObj.sn],
							vgasource: 4,
							UserId: parseInt(GloabFun.getKeyId())
						}, function(response) {}, function(response) {
							this.vga1Obj.waitting = false;
							// console.log('切换其他信号源',response)
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							this.getDatas();
							this.TCDetailIntervalid = setInterval(() => {
								this.getDatas();
							}, 5000)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			/**
				TC2000信号源
				**/
			//无信号源
			changeNoVGA() {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid)
					this.$nextTick(function() {
						this.vga2Obj.waitting = true;
						HttpServer.httpPost.call(this, '/Api/Peripheral/SignalSource', {
							sns: [this.templateObj.sn],
							vgasource: 0,
							UserId: parseInt(GloabFun.getKeyId())
						}, function(response) {}, function(response) {
							this.vga2Obj.waitting = false;
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							this.getDatas();
							this.TCDetailIntervalid = setInterval(() => {
								this.getDatas();
							}, 5000)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//本地信号源
			changeLocalVGA2() {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid)
					this.$nextTick(function() {
						this.vga2Obj.waitting = true;
						HttpServer.httpPost.call(this, '/Api/Peripheral/SignalSource', {
							sns: [this.templateObj.sn],
							vgasource: 1,
							UserId: parseInt(GloabFun.getKeyId())
						}, function(response) {}, function(response) {
							this.vga2Obj.waitting = false;
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							this.getDatas();
							this.TCDetailIntervalid = setInterval(() => {
								this.getDatas();
							}, 5000)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//切换电脑信号源
			changeComputerVGA() {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid)
					this.$nextTick(function() {
						this.vga2Obj.waitting = true;
						HttpServer.httpPost.call(this, '/Api/Peripheral/SignalSource', {
							sns: [this.templateObj.sn],
							vgasource: 2,
							UserId: parseInt(GloabFun.getKeyId())
						}, function(response) {}, function(response) {
							this.vga2Obj.waitting = false;
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							this.getDatas();
							this.TCDetailIntervalid = setInterval(() => {
								this.getDatas();
							}, 5000)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//切换外接信号源
			changeOutVGA() {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid)
					this.$nextTick(function() {
						this.vga2Obj.waitting = true;
						HttpServer.httpPost.call(this, '/Api/Peripheral/SignalSource', {
							sns: [this.templateObj.sn],
							vgasource: 3,
							UserId: parseInt(GloabFun.getKeyId())
						}, function(response) {}, function(response) {
							this.vga2Obj.waitting = false;
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							this.getDatas();
							this.TCDetailIntervalid = setInterval(() => {
								this.getDatas();
							}, 5000)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//切换展台信号源
			changeZhantaiVGA2() {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid)
					this.$nextTick(function() {
						this.vga2Obj.waitting = true;
						HttpServer.httpPost.call(this, '/Api/Peripheral/SignalSource', {
							sns: [this.templateObj.sn],
							vgasource: 4,
							UserId: parseInt(GloabFun.getKeyId())
						}, function(response) {}, function(response) {
							this.vga2Obj.waitting = false;
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							this.getDatas();
							this.TCDetailIntervalid = setInterval(() => {
								this.getDatas();
							}, 5000)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//控制电源管理器
			controlPdu(row1, row2) {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid);
					this.$nextTick(function() {
						row2.waitting = true;
						var param = {
							pdu: [{
								sn: this.templateObj.sn,
								pduChild: [{
									id: row1.id,
									number: [row2.number]
								}]
							}],
							onoff: row2.onoff ? 1 : 0,
							UserId: parseInt(GloabFun.getKeyId())
						}
						HttpServer.httpPost.call(this, '/Api/Peripheral/Pdus', param, function(response) {}, function(response) {
							row2.waitting = false;
							// console.log('控制电源管理器',response)
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										row2.onoff = !row2.onoff;
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									row2.onoff = !row2.onoff;
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								row2.onoff = !row2.onoff;
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							window.setTimeout(
								this.TCDetailIntervalid = setInterval(() => {
									this.getDatas();
								}, 5000), 5000
								)
						})
					})
				} else {
					row2.onoff = !row2.onoff;
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//控制投影仪
			controlProjector(row) {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid);
					row.waitting = true;
					var param = {
						content: [{
							sn: this.templateObj.sn,
							ids: [row.id]
						}],
						onoff: row.onoff ? 1 : 0,
						UserId: parseInt(GloabFun.getKeyId())
					}
					HttpServer.httpPost.call(this, '/Api/Peripheral/Projectors', param, function(response) {}, function(response) {
						row.waitting = false;
						// console.log('控制投影仪',response)
						if(response.data.code === 0) {
							if(response.data.response.length > 0) {
								if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
									this.$notify({
										title: '成功',
										message: '操作成功',
										type: 'success',
										duration: 2500
									});
								} else {
									row.onoff = !row.onoff;
									this.$notify.error({
										title: '错误',
										message: '操作失败',
										duration: 2500
									});
								}
							} else {
								row.onoff = !row.onoff;
								this.$notify.error({
									title: '错误',
									message: '操作无响应',
									duration: 2500
								});
							}
						} else {
							row.onoff = !row.onoff;
							this.$notify.error({
								title: '错误',
								message: response.data.msg,
								duration: 2500
							});
						}
						window.setTimeout(
							this.TCDetailIntervalid = setInterval(() => {
								this.getDatas();
							}, 5000), 5000
							)
					})
				} else {
					row.onoff = !row.onoff;
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//控制无线设备
			controlZigBee(row1, row2) {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid)
					this.$nextTick(function() {
						row2.waitting = true;
						var param = {
							zigbee: [{
								sn: this.templateObj.sn,
								zigbeeChild: [{
									id: row1.id,
									endpoint: [row2.ep]
								}]
							}],
							onoff: row2.state ? 1 : 0,
							UserId: parseInt(GloabFun.getKeyId())
						}
						HttpServer.httpPost.call(this, '/Api/Peripheral/ZigBeeOnOffs', param, function(response) {}, function(response) {
							row2.waitting = false;
							// console.log('控制无线设备',response)
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										row2.state = !row2.state;
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									row2.state = !row2.state;
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								row2.state = !row2.state;
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							window.setTimeout(
								this.TCDetailIntervalid = setInterval(() => {
									this.getDatas();
								}, 5000), 5000
								)
						})
					})
				} else {
					row2.state = !row2.state;
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			handleCommand(command) {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid)
					this.$nextTick(function() {
						this.relayControlLoading = true;
						var param = {
							Relay: [{
								sn: this.templateObj.sn,
								RelayChild: [{
									id: command.relayId,
									buttonid: [command.id]
								}]
							}],
							UserId: parseInt(GloabFun.getKeyId())
						}
						HttpServer.httpPost.call(this, '/Api/Peripheral/Relay', param, function(response) {}, function(response) {
							this.relayControlLoading = false;
							// console.log('控制继电设备',response);
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							window.setTimeout(
								this.TCDetailIntervalid = setInterval(() => {
									this.getDatas();
								}, 5000), 5000
								)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//控制红外遥控--开
			controlIrOn(row) {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid)
					this.$nextTick(function() {
						row.waitting = true;
						var param = {
							IRControl: [{
								sn: this.templateObj.sn,
								ids: [row.id]
							}],
							onoff: 1,
							UserId: parseInt(GloabFun.getKeyId())
						}
						HttpServer.httpPost.call(this, '/Api/Peripheral/IRControl', param, function(response) {}, function(response) {
							// console.log('打开红外遥控',response)
							row.waitting = false;
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							window.setTimeout(
								this.TCDetailIntervalid = setInterval(() => {
									this.getDatas();
								}, 5000), 5000
								)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//控制红外遥控--关
			controlIrOff(row) {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid)
					this.$nextTick(function() {
						row.waitting = true;
						var param = {
							IRControl: [{
								sn: this.templateObj.sn,
								ids: [row.id]
							}],
							onoff: 0,
							UserId: parseInt(GloabFun.getKeyId())
						}
						HttpServer.httpPost.call(this, '/Api/Peripheral/IRControl', param, function(response) {}, function(response) {
							// console.log('关闭红外遥控',response)
							row.waitting = false;
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							window.setTimeout(
								this.TCDetailIntervalid = setInterval(() => {
									this.getDatas();
								}, 5000), 5000
								)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//控制电脑
			controlCpt(row) {
				clearInterval(this.TCDetailIntervalid);
				this.$nextTick(function() {
					row.waitting = true;
					var param = {
						content: [{
							sn: this.templateObj.sn,
							ids: [row.id]
						}],
						onoff: row.state ? 1 : 0,
						UserId: parseInt(GloabFun.getKeyId())
					}
					HttpServer.httpPost.call(this, '/Api/Peripheral/Computers', param, function(response) {}, function(response) {
						row.waitting = false;
						if(response.data.code === 0) {
							if(response.data.response.length > 0) {
								if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
									this.$notify({
										title: '成功',
										message: '操作成功',
										type: 'success',
										duration: 2500
									});
								} else {
									row.state = !row.state;
									this.$notify.error({
										title: '错误',
										message: '操作失败',
										duration: 2500
									});
								}
							} else {
								row.state = !row.state;
								this.$notify.error({
									title: '错误',
									message: '操作无响应',
									duration: 2500
								});
							}
						} else {
							row.state = !row.state;
							this.$notify.error({
								title: '错误',
								message: response.data.msg,
								duration: 2500
							});
						}
						window.setTimeout(
							this.TCDetailIntervalid = setInterval(() => {
								this.getDatas();
							}, 5000), 5000
							)
					})
				})
			},
			//控制空调开关
			controlAirOnOff(row) {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid);
					this.$nextTick(function() {
						row.waitting = true;
						var param = {
							content: [{
								sn: this.templateObj.sn,
								ids: [row.id]
							}],
							op: row.state ? 1 : 0,
							// workmodel: row.workmodel,
							// temperature: row.temperature,
							UserId: parseInt(GloabFun.getKeyId())
						}
						HttpServer.httpPost.call(this, '/Api/Peripheral/AirConditioner', param, function(response) {}, function(response) {
							row.waitting = false;
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										row.state = !row.state;
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									row.state = !row.state;
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								row.state = !row.state;
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							window.setTimeout(
								this.TCDetailIntervalid = setInterval(() => {
									this.getDatas();
								}, 5000), 5000
								)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
					row.state = !row.state;
				}
			},
			//控制空调通断电
			controlAirSource(row) {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid);
					this.$nextTick(function() {
						row.waitting = true;
						var param = {
							content: [{
								sn: this.templateObj.sn,
								ids: [row.id]
							}],
							op: row.state1 ? 2 : 3,
							// workmodel: row.workmodel,
							// temperature: row.temperature,
							UserId: parseInt(GloabFun.getKeyId())
						}
						HttpServer.httpPost.call(this, '/Api/Peripheral/AirConditioner', param, function(response) {}, function(response) {
							row.waitting = false;
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										row.state1 = !row.state1;
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									row.state1 = !row.state1;
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								row.state1 = !row.state1;
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							window.setTimeout(
								this.TCDetailIntervalid = setInterval(() => {
									this.getDatas();
								}, 5000), 5000
								)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
					row.state1 = !row.state1;
				}
			},
			//空调升温
			controlAirHeating(row) {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid);
					this.$nextTick(function() {
						row.waitting = true;
						var param = {
							content: [{
								sn: this.templateObj.sn,
								ids: [row.id]
							}],
							op: 4,
							// workmodel: row.workmodel,
							// temperature: row.temperature,
							UserId: parseInt(GloabFun.getKeyId())
						}
						HttpServer.httpPost.call(this, '/Api/Peripheral/AirConditioner', param, function(response) {}, function(response) {
							row.waitting = false;
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							window.setTimeout(
								this.TCDetailIntervalid = setInterval(() => {
									this.getDatas();
								}, 5000), 5000
								)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//空调降温
			controlAirCooling(row) {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid);
					this.$nextTick(function() {
						row.waitting = true;
						var param = {
							content: [{
								sn: this.templateObj.sn,
								ids: [row.id]
							}],
							op: 5,
							// workmodel: row.workmodel,
							// temperature: row.temperature,
							UserId: parseInt(GloabFun.getKeyId())
						}
						HttpServer.httpPost.call(this, '/Api/Peripheral/AirConditioner', param, function(response) {}, function(response) {
							row.waitting = false;
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							window.setTimeout(
								this.TCDetailIntervalid = setInterval(() => {
									this.getDatas();
								}, 5000), 5000
								)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//调节温度
			adjustTemperature(row) {
				if(this.IsOnLine) {
					if(this.airFlag) {
						clearInterval(this.TCDetailIntervalid);
						this.$nextTick(function() {
							row.waitting = true;
							var param = {
								content: [{
									sn: this.templateObj.sn,
									ids: [row.id]
								}],
								op: 6,
								// workmodel: row.workmodel,
								temperature: row.temperature,
								UserId: parseInt(GloabFun.getKeyId())
							}
							HttpServer.httpPost.call(this, '/Api/Peripheral/AirConditioner', param, function(response) {}, function(response) {
								row.waitting = false;
								if(response.data.code === 0) {
									if(response.data.response.length > 0) {
										if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
											this.$notify({
												title: '成功',
												message: '操作成功',
												type: 'success',
												duration: 2500
											});
										} else {
											this.$notify.error({
												title: '错误',
												message: '操作失败',
												duration: 2500
											});
										}
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作无响应',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: response.data.msg,
										duration: 2500
									});
								}
								window.setTimeout(
									this.TCDetailIntervalid = setInterval(() => {
										this.getDatas();
									}, 5000), 5000
									)
							})
						})
					} else {
						// this.$notify({
						// 	title: this.$t('message.warning'),
						// 	message: '设备处于离线状态，不可控制。',
						// 	type: 'warning',
						// 	duration: 2500
						// });
						row.state = !row.state;
					}
				}
			},
			//改变空调工作模式
			changeWorkModel(row) {
				if(this.IsOnLine) {
					clearInterval(this.TCDetailIntervalid);
					this.$nextTick(function() {
						row.waitting = true;
						var param = {
							content: [{
								sn: this.templateObj.sn,
								ids: [row.id]
							}],
							op: 6,
							workmodel: row.workmodel,
							// temperature: row.temperature,
							UserId: parseInt(GloabFun.getKeyId())
						}
						HttpServer.httpPost.call(this, '/Api/Peripheral/AirConditioner', param, function(response) {}, function(response) {
							row.waitting = false;
							if(response.data.code === 0) {
								if(response.data.response.length > 0) {
									if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
										this.$notify({
											title: '成功',
											message: '操作成功',
											type: 'success',
											duration: 2500
										});
									} else {
										this.$notify.error({
											title: '错误',
											message: '操作失败',
											duration: 2500
										});
									}
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作无响应',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: response.data.msg,
									duration: 2500
								});
							}
							window.setTimeout(
								this.TCDetailIntervalid = setInterval(() => {
									this.getDatas();
								}, 5000), 5000
								)
						})
					})
				} else {
					this.$notify({
						title: this.$t('message.warning'),
						message: '设备处于离线状态，不可控制。',
						type: 'warning',
						duration: 2500
					});
				}
			},
			//控制继电器吸合断开
			controlRelay10(item1, item2){
				clearInterval(this.TCDetailIntervalid);
				this.$nextTick(function() {
					item2.waitting = true;
					var param = {
						sn: this.templateObj.sn,
						devices: [
						{
							id: item1.id,
							type: 0,
							port: item2.port
						}
						],
						operation: item2.status ? 1 : 0,
						UserId: parseInt(GloabFun.getKeyId())
					}
					HttpServer.httpPost.call(this, '/Api/Peripheral/Relay10', param, function(response) {}, function(response) {
						item2.waitting = false;
						if(response.data.code === 0) {
							if(response.data.response.length > 0) {
								if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
									this.$notify({
										title: '成功',
										message: '操作成功',
										type: 'success',
										duration: 2500
									});
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作失败',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: '操作无响应',
									duration: 2500
								});
							}
						} else {
							this.$notify.error({
								title: '错误',
								message: response.data.msg,
								duration: 2500
							});
						}
						window.setTimeout(
							this.TCDetailIntervalid = setInterval(() => {
								this.getDatas();
							}, 5000), 5000
							)
					})
				})
			},
			//吸合所有继电器端口
			openRelay10(item){
				clearInterval(this.TCDetailIntervalid);
				this.$nextTick(function() {
					item.waitting = true;
					var param = {
						sn: this.templateObj.sn,
						devices: [
						{
							id: item.id,
							type: 1
						}
						],
						operation: 1,
						UserId: parseInt(GloabFun.getKeyId())
					}
					HttpServer.httpPost.call(this, '/Api/Peripheral/Relay10', param, function(response) {}, function(response) {
						item.waitting = false;
						if(response.data.code === 0) {
							if(response.data.response.length > 0) {
								if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
									this.$notify({
										title: '成功',
										message: '操作成功',
										type: 'success',
										duration: 2500
									});
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作失败',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: '操作无响应',
									duration: 2500
								});
							}
						} else {
							this.$notify.error({
								title: '错误',
								message: response.data.msg,
								duration: 2500
							});
						}
						window.setTimeout(
							this.TCDetailIntervalid = setInterval(() => {
								this.getDatas();
							}, 5000), 5000
							)
					})
				})
			},
			//断开所有继电器端口
			closeRelay10(item){
				clearInterval(this.TCDetailIntervalid);
				this.$nextTick(function() {
					item.waitting = true;
					var param = {
						sn: this.templateObj.sn,
						devices: [
						{
							id: item.id,
							type: 1
						}
						],
						operation: 0,
						UserId: parseInt(GloabFun.getKeyId())
					}
					HttpServer.httpPost.call(this, '/Api/Peripheral/Relay10', param, function(response) {}, function(response) {
						item.waitting = false;
						if(response.data.code === 0) {
							if(response.data.response.length > 0) {
								if(response.data.response[0].sn == this.templateObj.sn && response.data.response[0].code === 0) {
									this.$notify({
										title: '成功',
										message: '操作成功',
										type: 'success',
										duration: 2500
									});
								} else {
									this.$notify.error({
										title: '错误',
										message: '操作失败',
										duration: 2500
									});
								}
							} else {
								this.$notify.error({
									title: '错误',
									message: '操作无响应',
									duration: 2500
								});
							}
						} else {
							this.$notify.error({
								title: '错误',
								message: response.data.msg,
								duration: 2500
							});
						}
						window.setTimeout(
							this.TCDetailIntervalid = setInterval(() => {
								this.getDatas();
							}, 5000), 5000
							)
					})
				})
			},
			//刷新
			reloadDatas() {
				this.volumeFlag = false;
				this.airFlag = false;
				this.loading = true;
				HttpServer.httpPost.call(this, this.api, {
					sn: [this.templateObj.sn]
				}, function(response) {}, function(response) {
					this.loading = false;
					if(response.data.code === 0) {
						this.pingTime = response.data.info[0].pingtime;
						if(response.data.info[0].status != null) {
							this.deviceData = [];
							response.data.info[0].status.name = this.templateObj.name;
							this.deviceData.push(response.data.info[0].status);
							response.data.info[0].status.microphone = response.data.info[0].status.microphone ? true : false;
							this.statusDatas = response.data.info[0].status;
							this.getPeripheralDatas();
							this.$notify({
								title: '成功',
								message: this.$t('message.refreshSuccess'),
								type: 'success',
								duration: 2500
							});
						}
					} else {
						this.$notify.error({
							title: '错误',
							message: response.data.msg,
							duration: 2500
						});
					}
				});
			},
			initData(array, str) {
				if(array) {
					array.forEach(function(item) {
						item[str] = item[str] === 1? true : false;
						item.waitting = false;
					})
				}
				return array;
			},
			initData2(array, str1, str2) {
				if(array) {
					array.forEach(function(item) {
						item[str1] = item[str1] === 1 ? true : false;
						item[str2] = item[str2] === 1 ? true : false;
						item.waitting = false;
					})
				}
				return array;
			},
			initData3(array, str2) {
				if(array) {
					array.forEach(function(item1) {
						if(item1.onoff && item1.onoff.length > 0) {
							item1.onoff.forEach(function(item2) {
								item2[str2] = item2[str2] === 1 ? true : false;
								item2.waitting = false;
							})
						}
					})
				}
				return array;
			},
			//查询外设详情
			getPeripheralDatas() {
				// this.loading = true;
				HttpServer.httpPost.call(this, '/Api/Device/PeripheralDetailInfo', {
					devicesn: [this.templateObj.sn],
					ptype: [0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11]
				}, function(response) {}, function(response) {
					this.volumeFlag = true;
					this.airFlag = true;
					// this.loading = false;
					if(response.data.code === 0) {
						//电源管理器数据处理
						let vm = this;
						if(response.data.info.length === 0){
							this.$notify.error({
								title: '错误',
								message: '无外接设备',
								duration: 2500
							});
							return
						}
						if(response.data.info[0].intechpdu != null) {
							response.data.info[0].intechpdu.forEach(function(item) {
								item.socket = vm.initData(item.socket, "onoff");
							})
							this.pduDatas = response.data.info[0].intechpdu;
						}
						//投影仪数据处理
						if(response.data.info[0].projector != null) {
							this.projectorDatas = this.initData(response.data.info[0].projector, "onoff");
						}
						//zb无线设备数据处理
						if(response.data.info[0].zb != null) {
							// this.zbSensorDatas = [];
							// response.data.info[0].zb.forEach(function(item) {
								//筛选传感器数据
								// if(item.illumination.length > 0 || item.temperature.length > 0 || item.humidity.length > 0 || item.meter.length > 0) {
								// 	vm.zbSensorDatas.push(item);
								// }
							// })
							this.zbDatas = this.initData3(response.data.info[0].zb, "state");
						}

						//继电设备
						if(response.data.info[0].relay != null) {
							response.data.info[0].relay.forEach(function(item) {
								//这里将id放在func按钮对象中，方便后面调用
								if(item.func && item.func.length){
									for(var i = 0 ; i <item.func.length; i ++){
										item.func[i].relayId = item.id;
									}
								}
							})
							this.relayDatas = response.data.info[0].relay;
						}

						//红外遥控
						if(response.data.info[0].ir != null) {
							response.data.info[0].ir.forEach(function(item) {
								item.waitting = false;
							})
							this.irDatas = response.data.info[0].ir;
						}
						//电脑
						if(response.data.info[0].cpt != null) {
							this.cptDatas = this.initData2(response.data.info[0].cpt, "state", "status");
						}
						//空调数据
						if(response.data.info[0].air != null) {
							this.airDatas = this.initData2(response.data.info[0].air, "state", "state1");
						}
						//传感器数据
						if(response.data.info[0].sensor != null) {
							this.sensorDatas = response.data.info[0].sensor;
						}
						//led显示屏
						if(response.data.info[0].leddigsig != null){
							this.leddigsigDatas = response.data.info[0].leddigsig;
						}
						//继电器设备
						if(response.data.info[0].relay10 != null && response.data.info[0].relay10.length > 0){
							response.data.info[0].relay10.forEach(function(item){
								item.waitting = false;
								if(item.func != null && item.func.length > 0){
									item.func.forEach(function(item2){
										item2.waitting = false;
										item2.status = item2.state == 1 ? true : false;
									})
								}
							})
							this.relay10Datas = response.data.info[0].relay10;
						}
						//一体机数据
						if(response.data.info[0].aio != null && response.data.info[0].aio.length > 0){
							response.data.info[0].aio.forEach(function(item){
								item.waitting = false;
								item.aiostatus = item.aiostatus === 1 ? true : false;
								item.pcstatus = item.pcstatus === 1 ? true : false;
								item.microstatus = item.microstatus === 1 ? true : false;
								item.bluetoothstatus = item.bluetoothstatus === 1 ? true : false;
								item.online = item.online === 1 ? true : false;
							})
							this.aioDatas = response.data.info[0].aio;
						}
					}
				})
			},
			getDatas() {
				this.volumeFlag = false;
				this.airFlag = false;
				// this.loading = true;
				HttpServer.httpPost.call(this, this.api, {
					sn: [this.templateObj.sn]
				}, function(response) {}, function(response) {
					// console.log('中控设备详情',response)
					// this.loading = false;
					if(response.data.code === 0) {
						this.pingTime = response.data.info[0].pingtime;
						if(response.data.info[0].status != null) {
							this.deviceData = [];
							response.data.info[0].status.name = this.templateObj.name;
							this.deviceData.push(response.data.info[0].status);
							response.data.info[0].status.microphone = response.data.info[0].status.microphone ? true : false;
							response.data.info[0].status.quiet = response.data.info[0].status.quiet ? true : false;
							if(this.templateObj.model == 'TC2000'){
								response.data.info[0].status.preview = response.data.info[0].status.preview ? true : false;
							}
							this.statusDatas = response.data.info[0].status;
							// this.controlVolumeObj.volume = response.data.info[0].status.volume;
							this.getPeripheralDatas();
						}
					} else {}
				});
			}
		},
		created() {
			this.IsOnLine = this.templateObj.online;
			this.api = this.templateObj.model === 'TC1000' ? '/Api/TC1000/AllInfo' : '/Api/NCC/TC2000/AllInfo';
			this.getDatas();
			// if(this.templateObj.online) {
			// 	this.TCDetailIntervalid = setInterval(() => {
			// 		this.getDatas();
			// 	}, 5000)
			// }
		},
		beforeDestroy() {
			clearInterval(this.TCDetailIntervalid);
		},	
	}
</script>

<style scoped>
	@import '../../../../assets/css/font-awesome-4.7.0/css/font-awesome.css';
</style>
<style scoped lang="less">
	@import '../../../../assets/css/media-screen.less';
</style>
<style scoped>
	@import '../../../../assets/css/ext-iconfont.css';
</style>
<style scoped>
	@import '../../../../assets/css/font_1226/iconfont.css';
</style>
<style scoped lang="less">
	* {
		box-sizing: border-box;
	}
	
	.el-date-editor.el-input {
		width: 115px;
	}
	
	.inner-section {
		// margin: 5px 5px;
		// height: 100%;
		// border: 1px solid #BEBEBE;
		.flash-object {
			// margin: 5px 0;
			height: 368px;
			// height: e("calc(100% - 40px)");
			position: relative;
		}
		.opreat-button {
			//text-align: center;
		}
	}
	
	.navList {
		width: 100%;
		padding: 3px 0;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
	
	.el-row {
		margin-bottom: 5px;
		.bg-purple {
			width: 100%;
			// background: #EAF4FF;
			.detail-title {
				text-align: center;
				i {
					font-size: 40px;
				}
			}
			.middle-section {
				width: 100%;
				display: flex;
				.middle-bg {}
			}
			.icon-default {
				color: #999999;
			}
			.panel-title {
				width: 100%;
				height: 30px;
				color: white;
				// background-color: rgba(32,160,255,.2);
				background-color: #20A0FF;
				border-radius: 3px;
				// border-bottom: 1px solid #20A0FF;
				line-height: 30px;
				padding-left: 10px;
				.title-img {
					width: 30%;
					float: right;
					height: 100%;
					width: 100px
				}
			}
			.detail-section {
				width: 100%;
				height: 80px;
				display: flex;
				justify-content: space-around;
				.section-left {
					display: flex;
					flex-direction: column;
					justify-content: space-around;
					align-items: center;
					width: 40%;
					height: 100%;
				}
				.section-right {
					text-align: center;
					display: flex;
					flex-direction: column;
					justify-content: space-around;
					// align-items: center;
					width: 60%;
					padding: 3px;
					// padding-left: 6px;
					height: 100%;
				}
			}
			.detail-section2 {
				width: 100%;
				height: 100px;
				// display: flex;
				flex-direction: column;
				justify-content: space-around;
				.section-top2 {
					// display: flex;
					// flex-direction: column;
					justify-content: space-around;
					// border-bottom: 1px solid #B0B0B0;
					// align-items: center;
					text-align: center;
					padding-top: 2px;
					width: 100%;
					height: 25px;
					line-height: 25px;
				}
				.section-bottom2 {
					// text-align: center;
					display: flex;
					// flex-direction: column;
					justify-content: space-around;
					// align-items: center;
					// width: 100%;
					padding-top: 5px;
					height: 75%;
					.section-bottom3 {
						// border: 1px solid #B0B0B0;
						display: flex;
						// flex-direction: column;
						justify-content: space-around;
						// align-items: center;
						// width: 40%;
						height: 100%;
						padding: 0 5px;
						.section-left3 {
							display: flex;
							flex-direction: column;
							justify-content: space-around;
							// width: 40%;
							height: 100%;
						}
						.section-right3 {
							text-align: left;
							// display: flex;
							flex-direction: column;
							justify-content: space-around;
							padding: 3px;
							// padding-left: 6px;
							height: 100%;
						}
					}
				}
			}
		}
	}
	
	.grid-content {
		border: 1px solid #FFFFFF;
		height: 400px;
	}
	
	.grid-content1 {
		box-shadow: 0 1px 4px #000;
		border-radius: 5px;
		margin-top: 1px;
		height: 100%;
	}
	
	.row-bg {
		padding: 10px 0;
		background-color: #f9fafc;
	}
</style>
<style lang="less">
	.el-slider__button {
		background-color: #ff5410;
	}
	
	.el-slider__button.hover {
		background-color: #ff5410;
	}
	
	.el-slider__bar {
		background-color: #ffc310;
	}
</style>